#这是一个教程文件，旨在使初学者快速掌握本库基本函数，该文本不能运行！！！
#This is a tutorial file designed to enable beginners to quickly master the basic functions of this library, which cannot be run!!
from ST7735 import TFT
from sysfont import sysfont
from machine import SPI,Pin
spi = SPI(2, baudrate=20000000, polarity=0, phase=0, sck=Pin(18), mosi=Pin(23))
tft=TFT(spi,16,17,27)
tft.initr()#重置刷新
tft.rgb(True)

#color处填:  TFT.COLOR大写/TFT.color(r,g,b)
def lines(color):
    tft.line((0,0),(x, tft.size()[1] - 1), color)#line((x1,y1),(x2,y2),color)

def rects(color):
    tft.rect((tft.size()[0]//2 - x//2, tft.size()[1]//2 - x/2), (x, x), color)#rect((x1,y1),(x2,y2),color)

def fillrects(color):
    tft.fillrect((tft.size()[0]//2 - x//2, tft.size()[1]//2 - x/2), (x, x), color)#fillrect((x1,y1),(x2,y2),color)


def fillcircles(radius, color):
    tft.fillcircle((x, y), radius, color)#fillcircle((x,y),radius半径,color)

def circles(radius, color):
    tft.circle((x, y), radius, color)#circle((x,y),radius半径,color)

def text():
    tft.text((0, v), "Hello World!", TFT.RED, sysfont, 1, nowrap=True)#text((x,y),text,color,sysfont字体库,size,nowrap是否换行)
